Skip to content

[Feat][KV offload][WIP] Separated process for CPU KV cache processing #22607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ApostaC
Copy link
Collaborator

@ApostaC ApostaC commented Aug 10, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

This PR is part of #22605

It introduces the structure of the CPU KV manager process and how the scheduler should talk with the process.

Test Plan

Test Result

(Optional) Documentation Update

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a separate process for CPU KV cache management, which is a significant architectural change. The implementation establishes the communication protocol and server structure using ZMQ. My review focuses on the completeness and robustness of this new component.

I've identified several areas where the implementation is incomplete, particularly concerning the 'onload' functionality, which is part of the feature's scope but not fully implemented in the protocol or server logic. Additionally, there are inconsistencies in logging practices, where print is used instead of the configured logger, which can hinder debugging and monitoring in production environments. These issues are critical to address to ensure the feature is robust and maintainable.

Comment on lines +21 to +22
ONLOAD_REQUEST = enum.auto()
ONLOAD_FINISHED = enum.auto()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The KVServerCmd enum includes ONLOAD_REQUEST and ONLOAD_FINISHED, but the corresponding message structures (e.g., KVServerOnloadRequest, KVServerOnloadFinished) are not defined. This incompleteness prevents the implementation of the onload functionality and will cause decode_payload to fail for these commands. Please define the necessary msgspec.Struct classes for onload operations and integrate them into the protocol, including the KVServerMsg union.


def scheduler_process_response(socket: zmq.Socket,
finished_offloads: list[str],
finished_onloads: list[str]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The finished_onloads parameter is unused because the function does not handle ONLOAD_FINISHED commands, despite the docstring indicating it should. This suggests the feature implementation is incomplete. Please add logic to process onload responses and populate this list, which will also require defining the ONLOAD_FINISHED message in protocol.py.

Comment on lines +150 to +153
def handle_onload_request(self, client_id, cmd, payload):
print("Received onload request from:", client_id)

# TODO: Do something here?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The handle_onload_request method is a stub that only prints to the console. This is a critical part of the KV cache offload/onload feature that remains unimplemented. Please implement the full logic for handling onload requests.

ApostaC and others added 2 commits August 10, 2025 16:50
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Yihua Cheng <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Yihua Cheng <[email protected]>
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@ApostaC ApostaC changed the title [Feat][KV offload] Separated process for CPU KV cache processing [Feat][KV offload][WIP] Separated process for CPU KV cache processing Aug 11, 2025
@ApostaC ApostaC marked this pull request as draft August 11, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant